<template>
  <div class="app-container home">
    <el-container>
<!--      <el-header >商城经营数据</el-header>-->
      <el-main>
        <el-row>
          <el-col :span="24">
            <p style="font-weight :bold ; font-size: 15px;text-align: left;">商城经营数据</p>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="5">
            <span class="exp-b center" @click="sendGoods" >{{toSendProductNum}}</span>
          </el-col>
          <el-col :span="5">
            <span class="exp-b center" @click="refund">{{refundTrade}}</span>
          </el-col>
          <el-col :span="5">
            <span class="exp-b center" @click="shelves">{{itemUpshelf}}</span>
          </el-col>
          <el-col :span="9">
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="5">
            <div class="grid-content bg-purple center">待发货订单</div>
          </el-col>
          <el-col :span="5">
            <div class="grid-content bg-purple-light center">退款中订单</div>
          </el-col>
          <el-col :span="5">
            <div class="grid-content bg-purple center">上架商品</div>
          </el-col>
          <el-col :span="9">
          </el-col>
        </el-row>
      </el-main>

    </el-container>

    <el-container>
      <el-main>
        <el-row>
          <el-col :span="24">
            <p style="font-weight :bold ;  font-size: 15px;text-align: left;">团购平台经营数据</p>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="5">
            <span class="exp-b center" @click="toAudit">{{approvalInBusiness}}</span>
          </el-col>
          <el-col :span="5">
            <span class="exp-b center" @click="stores">{{storeNumber}}</span>
          </el-col>

        </el-row>
        <el-row>
          <el-col :span="5">
            <div class="grid-content bg-purple center">待审核入驻商家</div>
          </el-col>
          <el-col :span="5">
            <div class="grid-content bg-purple-light center">门店数量</div>
          </el-col>

        </el-row>
      </el-main>
    </el-container>
  </div>
</template>

<script>
  import {countToSendProductNum,orderInRefund,goodsShelves,merchantsToBeAudited,numberOfStores} from "@/api/HomePage";
export default {
  name: "Index",
  data() {
    return {
      // 版本号
      version: "3.7.0",
      //商城代发货订单
      toSendProductNum:0,
      //退款中订单
      refundTrade:0,
      //上架商品
      itemUpshelf:0,
      //待审核入住商家
      approvalInBusiness:0,
      //门店数量
      storeNumber:0,
    };
  },
  created() {
    this.countToSendProductNum ();
    this.orderInRefund();
    this.goodsShelves();
    this. merchantsToBeAudited();
    this. numberOfStores();

    let timer = setInterval(() =>{
      this.countToSendProductNum ();
      this.orderInRefund();
      this.goodsShelves();
      this. merchantsToBeAudited();
      this. numberOfStores();
    },60000)
  },
  methods: {
    //商城代发货订单
    countToSendProductNum(){
      countToSendProductNum().then(response => {
        this.toSendProductNum = response.data;

      });
    },

    sendGoods(){
      this.$router.push({ path: '/shopping/mallOrder', query: { orderState:"wait_ship"}});
    },
    //退款中订单
    orderInRefund(){
      orderInRefund().then(response => {
        this.refundTrade = response.data;
      });
    },
    refund(){
      this.$router.push({ path: '/shopping/mallAfterSaleOrder', query: { refundStatus:"apply"}});
    },
    //上架商品
    goodsShelves(){
      goodsShelves().then(response => {
        this.itemUpshelf = response.data;
      });
    },
    shelves(){
      this.$router.push({ path: '/shopping/mallProduct', query: { isShow:"Y"}});
    },
    //待审核入住商家
    merchantsToBeAudited(){
      merchantsToBeAudited().then(response => {
        this.approvalInBusiness = response.data;
      });
    },
    toAudit(){
      this.$router.push({ path: '/store/storeApply', query: { applyState:"audit_IN"}});
    },
    //门店数量
    numberOfStores(){
      numberOfStores().then(response => {
        this.storeNumber = response.data;
      });
    },
    stores(){
      this.$router.push({ path: '/store/store'});
    },

    goTarget(href) {
      window.open(href, "_blank");
    },
  },
};
</script>

<style scoped lang="scss">
.home {
  blockquote {
    padding: 10px 20px;
    margin: 0 0 20px;
    font-size: 17.5px;
    border-left: 5px solid #eee;
  }
  hr {
    margin-top: 20px;
    margin-bottom: 20px;
    border: 0;
    border-top: 1px solid #eee;
  }
  .col-item {
    margin-bottom: 20px;
  }

  ul {
    padding: 0;
    margin: 0;
  }

  font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: #676a6c;
  overflow-x: hidden;

  ul {
    list-style-type: none;
  }

  h4 {
    margin-top: 0px;
  }

  h2 {
    margin-top: 10px;
    font-size: 26px;
    font-weight: 100;
  }

  p {
    margin-top: 10px;

    b {
      font-weight: 700;
    }
  }

  .update-log {
    ol {
      display: block;
      list-style-type: decimal;
      margin-block-start: 1em;
      margin-block-end: 1em;
      margin-inline-start: 0;
      margin-inline-end: 0;
      padding-inline-start: 40px;
    }
  }
}
.home{
  background-color:#F5F5F5;
}
.el-container{
  background-color: #ffffff;
  margin-bottom: 20px;
}
.el-containerel-container
.el-header {
  font-weight:bold;
  text-align: center;
  line-height: 60px;
}
.center{
  text-align: center;
  display: block;
}
.grid-content{
  font-weight: 600;
  padding: 15px 0;
}
.exp-b{
  font-size:30px;
  font-weight:bold
}
</style>

<style>

  /* 配置CSS字体大小为20px 同时 字体加粗 */
</style>
